package com.fone.player.play.adapter;

import com.fone.player.ApplicationManage;
import com.fone.player.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
/**
 * 开关模式菜单适配器
 * 
 * @author kongxiaojun
 * @since 2014-5-21
 */
public class MenuSwithAdapter extends BaseAdapter {

	/**
	 * 当前开关状态,0.关闭;1.开启
	 */
	private int currentState = 0;
	
	public MenuSwithAdapter(int currentState) {
		super();
		this.currentState = currentState;
	}

	@Override
	public int getCount() {
		return 2;
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		convertView = LayoutInflater.from(ApplicationManage.getAplicationManageInstance()).inflate(R.layout.player_full_second_menu_item, null);
		TextView tv = (TextView) convertView.findViewById(R.id.second_menu_3d_text);
		View divider = convertView.findViewById(R.id.second_menu_3d_divider);
		
		if(position == 0){
			tv.setText(R.string.video_fullscreen_open);
			if(currentState == 1){
				tv.setTextColor(ApplicationManage.getAplicationManageInstance().getResources().getColor(R.color.video_info_tab_line));
			}else {
				tv.setTextColor(ApplicationManage.getAplicationManageInstance().getResources().getColor(R.color.white));
			}
			divider.setVisibility(View.VISIBLE);
		}else {
			tv.setText(R.string.video_fullscreen_close);
			if(currentState == 0){
				tv.setTextColor(ApplicationManage.getAplicationManageInstance().getResources().getColor(R.color.video_info_tab_line));
			}else {
				tv.setTextColor(ApplicationManage.getAplicationManageInstance().getResources().getColor(R.color.white));
			}
			divider.setVisibility(View.GONE);
		}
		
		return convertView;
	}

}
